<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="班次名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
              <a-input v-model="model.name" placeholder="请输入班次名称"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="班次负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="staffLeader">
              <j-select-user-by-dep v-model="model.userId" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="上班时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workBeginTime" >
              <j-time v-model="model.workBeginTime"  dateFormat="HH:mm"/>
              <span  style="margin-left: 10px">打卡<a-switch v-model="model.workBeginTimeSign"/></span>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" v-if="model.workBeginTimeSign">
            <a-form-model-item label="上班打卡时段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workBeginSignBefore">
              上班前
              <a-cascader :options="timeOptions" style="width: 150px;" v-model="model.workBeginSignBefore" placeholder="请选择" />
            至上班后
              <a-cascader :options="timeOptions" style="width: 150px;" v-model="model.workBeginSignAfter" placeholder="请选择" />
            </a-form-model-item>
          </a-col>

          <a-col :span="24">
            <a-form-model-item label="下班时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workEndTime">
              <j-time v-model="model.workEndTime"  dateFormat="HH:mm"/>
              <span   style="margin-left: 10px">打卡<a-switch v-model="model.workEndTimeSign"/></span>
            </a-form-model-item>

          </a-col>
          <a-col :span="24"  v-if="model.workEndTimeSign">
            <a-form-model-item label="下班打卡时段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workEndSignBefore">
              下班前
              <a-cascader :options="timeOptions" style="width: 150px;" v-model="model.workEndSignBefore" placeholder="请选择" />

              至下班后
             <a-cascader :options="timeOptions" style="width: 150px;" v-model="model.workEndSignAfter" placeholder="请选择" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <a-form-model-item label="休息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workEndSignBefore">
              <a-switch v-model="model.restTimeIsOn"/>
            </a-form-model-item>
          </a-col>

          <a-col :span="24" v-if="model.restTimeIsOn">
            <a-form-model-item label="休息时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="restBeginTime">
              <j-time  v-model="model.restBeginTime" :showTime="true" dateFormat="HH:mm"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" v-if="model.restTimeIsOn">
            <a-form-model-item label="休息时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="restEndTime">
              <j-time  v-model="model.restEndTime" :showTime="true" dateFormat="HH:mm"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>

  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'

  export default {
    name: 'WorkTimeForm',
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data() {
      return {
        model: {
          restTimeIsOn: false
        },
        labelCol: {
          xs: {span: 24},
          sm: {span: 5},
        },
        jCheckboxOptions: [
          {label: '打卡', value: '1'}
        ],
        wrapperCol: {
          xs: {span: 24},
          sm: {span: 16},
        },
        confirmLoading: false,
        validatorRules: {
          name: [
            { required: true, message: '请输入班级名称!'},
          ],
          userId: [
            { required: true, message: '请选择班次负责人!'},
          ],
          workBeginTime: [
            { required: true, message: '请选择上班时间!'},
          ],
          workEndTime: [
            { required: true, message: '请选择下班时间!'},
          ],
        },
        timeOptions: [
          {
            value: '0',
            label: '0小时',
            children: [
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          },
          {
            value: '1',
            label: '1小时',
            children: [
              {
                value: '0',
                label: '0分钟'
              },
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          },
          {
            value: '2',
            label: '2小时',
            children: [
              {
                value: '0',
                label: '0分钟'
              },
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          },
          {
            value: '3',
            label: '3小时',
            children: [
              {
                value: '0',
                label: '0分钟'
              },
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          },
          {
            value: '4',
            label: '4小时',
            children: [
              {
                value: '0',
                label: '0分钟'
              },
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          },
          {
            value: '5',
            label: '5小时',
            children: [
              {
                value: '0',
                label: '0分钟'
              },
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          },
          {
            value: '6',
            label: '6小时',
            children: [
              {
                value: '0',
                label: '0分钟'
              },
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          },
          {
            value: '7',
            label: '7小时',
            children: [
              {
                value: '0',
                label: '0分钟'
              },
              {
                value: '1',
                label: '1分钟'
              },
              {
                value: '2',
                label: '2分钟'
              },
              {
                value: '3',
                label: '3分钟'
              },
              {
                value: '4',
                label: '4分钟'
              },
              {
                value: '5',
                label: '5分钟'
              },
              {
                value: '6',
                label: '6分钟'
              },
              {
                value: '7',
                label: '7分钟'
              },
              {
                value: '8',
                label: '8分钟'
              },
              {
                value: '9',
                label: '9分钟'
              },
              {
                value: '10',
                label: '10分钟'
              },
              {
                value: '11',
                label: '11分钟'
              },
              {
                value: '12',
                label: '12分钟'
              },
              {
                value: '13',
                label: '13分钟'
              },
              {
                value: '14',
                label: '14分钟'
              },
              {
                value: '15',
                label: '15分钟'
              },
              {
                value: '16',
                label: '16分钟'
              },
              {
                value: '17',
                label: '17分钟'
              },
              {
                value: '18',
                label: '18分钟'
              },
              {
                value: '19',
                label: '19分钟'
              },
              {
                value: '20',
                label: '20分钟'
              },
              {
                value: '21',
                label: '21分钟'
              },
              {
                value: '22',
                label: '22分钟'
              },
              {
                value: '23',
                label: '23分钟'
              },
              {
                value: '24',
                label: '24分钟'
              },
              {
                value: '25',
                label: '25分钟'
              },
              {
                value: '26',
                label: '26分钟'
              },
              {
                value: '27',
                label: '27分钟'
              },
              {
                value: '28',
                label: '28分钟'
              },
              {
                value: '29',
                label: '29分钟'
              },
              {
                value: '30',
                label: '30分钟'
              },
              {
                value: '31',
                label: '31分钟'
              },
              {
                value: '32',
                label: '32分钟'
              },
              {
                value: '33',
                label: '33分钟'
              },
              {
                value: '34',
                label: '34分钟'
              },
              {
                value: '35',
                label: '35分钟'
              },
              {
                value: '36',
                label: '36分钟'
              },
              {
                value: '37',
                label: '37分钟'
              },
              {
                value: '38',
                label: '38分钟'
              },
              {
                value: '39',
                label: '39分钟'
              },
              {
                value: '40',
                label: '40分钟'
              },
              {
                value: '41',
                label: '41分钟'
              },
              {
                value: '42',
                label: '42分钟'
              },
              {
                value: '43',
                label: '43分钟'
              },
              {
                value: '44',
                label: '44分钟'
              },
              {
                value: '45',
                label: '45分钟'
              },
              {
                value: '46',
                label: '46分钟'
              },
              {
                value: '47',
                label: '47分钟'
              },
              {
                value: '48',
                label: '48分钟'
              },
              {
                value: '49',
                label: '49分钟'
              },
              {
                value: '50',
                label: '50分钟'
              },
              {
                value: '51',
                label: '51分钟'
              },
              {
                value: '52',
                label: '52分钟'
              },
              {
                value: '53',
                label: '53分钟'
              },
              {
                value: '54',
                label: '54分钟'
              },
              {
                value: '55',
                label: '55分钟'
              },
              {
                value: '56',
                label: '56分钟'
              },
              {
                value: '57',
                label: '57分钟'
              },
              {
                value: '58',
                label: '58分钟'
              },
              {
                value: '59',
                label: '59分钟'
              }
            ]
          }
          ],
      url: {
        add: "/satff/workTime/add",
          edit
      :
        "/satff/workTime/edit",
          queryById
      :
        "/satff/workTime/queryById"
      }
    }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        if (this.model.workEndSignAfter != null) {
          this.model.workEndSignAfter = this.model.workEndSignAfter.split('-');
        }
        if (this.model.workEndSignBefore != null) {
          this.model.workEndSignBefore = this.model.workEndSignBefore.split('-');
        }
        if (this.model.workBeginSignAfter != null) {
          this.model.workBeginSignAfter = this.model.workBeginSignAfter.split('-');
        }
        if (this.model.workBeginSignBefore != null) {
          this.model.workBeginSignBefore = this.model.workBeginSignBefore.split('-');
        }
        this.visible = true;
      },
      submitForm () {
        const that = this;
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            if (this.model.workEndSignAfter != null) {
              this.model.workEndSignAfter = this.model.workEndSignAfter.join('-');
            }
            if (this.model.workEndSignBefore != null) {
              this.model.workEndSignBefore = this.model.workEndSignBefore.join('-');
            }
            if (this.model.workBeginSignAfter != null) {
              this.model.workBeginSignAfter = this.model.workBeginSignAfter.join('-');
            }
            if (this.model.workBeginSignBefore != null) {
              this.model.workBeginSignBefore = this.model.workBeginSignBefore.join('-');
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
            });
          }

        })
      },
    }
  }
</script>